﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for District
/// </summary>
/// 
namespace Commercial
{
    public class Districts
    {
        Up1VNDataContext db = new Up1VNDataContext();
        public Districts()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public IList<District> ListDistrict()
        {
            var query = db.Districts.Where(x => x.active == 1).ToList();
            return query;
        }

        public IList<District> ListDistrict(int id_city)
        {
            var query = db.Districts.Where(x => x.id_city == id_city && x.active == 1).ToList();
            return query;
        }

        public District DetailDistrict(int id)
        {
            var query = db.Districts.Where(x => x.id == id).FirstOrDefault();
            return query;
        }

    }
}